﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script type="text/javascript">
    var status = '@ViewBag.status';
    var number = '@ViewBag.number';
    $(function () {
        initControl();
    });
    function initControl() {
        if (status == 'U') {
            if ($('#oldEntity').val() != '') {
                var data = JSON.parse($('#oldEntity').val());
                setDataByJson("#form1", data);
            }
            $('#FContainerNO').prop("readonly", true);
        }
        initBindSelect("#form1");
    }
    function btn_ok() {
        submitForm();
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/MainData/Accessories/SubmitAccessoriesListForm?status=" + status + "&keyValue=" + number,
            param: $("#form1").formSerialize(),
            success: function (result) {
                if (status == 'I') {
                    parent.reloadGrid(result.data);
                } else {
                    parent.reloadGrid();
                }
                parent.$.detailClose();
            }
        })
    }
    function btn_cancel() {
        parent.$.detailClose();
    }
</script>
<div class="ui-layout" id="layout" style="height: 96%; width: 100%;">
    <input id="oldEntity" type="hidden" value="@ViewBag.oldEntity" />
    <form id="form1">
        <div style="width:900px;margin:0 auto;">
            <table class="form" style="width:900px;text-align:right;margin:15px;border-bottom:2px solid #ccc;">
                <tr>
                    <td class="formValue input-width-185" style="width:500px;padding-left:100px;text-align:left;">
                        &nbsp;
                    </td>
                    <td style="width: 300px; padding: 5px 10px;">
                        <div class="btn-group" style="margin-right:20px;">
                            <a id="" class="btn btn-primary center-block" onclick="btn_ok()"><span class="glyphicon glyphicon-ok"></span> 确认</a>
                        </div>
                        <div class="btn-group">
                            <a id="" class="btn btn-primary center-block" onclick="btn_cancel()"><span class="glyphicon glyphicon-remove"></span> 取消</a>
                        </div>
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;">
                <tr>
                    <th class="formTitle" style="width:100px;">辅料图号</th>
                    <td class="formValue input-width-210" style="width:220px;">
                        <input id="AccessoriesNO" name="AccessoriesNO" type="text" class="form-control required" value="" />
                        <input id="AccessoriesID" name="AccessoriesID" type="hidden" value="" />
                    </td>
                    <th class="formTitle" style="width:80px;">&nbsp;</th>
                    <td class="formValue">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">辅料名称</th>
                    <td class="formValue input-width-320" colspan="3">
                        <input id="AccessoriesName" name="AccessoriesName" type="text" class="form-control required" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">辅料分类</th>
                    <td class="formValue input-width-185">
                        <select id="AccessoriesTypeNO" name="AccessoriesTypeNO" class="form-control required">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.accessoriesType)
                            {
                                <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                    <th class="formTitle">辅料用途</th>
                    <td class="formValue input-width-210">
                        <select id="purposeNO" name="purposeNO" class="form-control required">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.purpose)
                            {
                                <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">规格型号</th>
                    <td class="formValue input-width-185">
                        <input id="SpeciModel" name="SpeciModel" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">计量单位</th>
                    <td class="formValue input-width-210">
                        <select id="MeaUnitsNO" name="MeaUnitsNO" class="form-control required">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.meaunits)
                            {
                                <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">品牌产地</th>
                    <td class="formValue input-width-185">
                        <input id="BrandOrigin" name="BrandOrigin" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">消耗定额</th>
                    <td class="formValue input-width-120">
                        <input id="ConsumptionQuota" name="ConsumptionQuota" type="text" class="form-control text-right number" value="" /> <label>Kg</label>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

